local extension = Package("e_cards", Package.CardPack)
extension.extensionName = "evolution"
--extension.game_modes_whitelist = {"brokenroyal_mode"}

local EV = require "packages/evolution/EV"
local U = require "packages/utility/utility"

Fk:loadTranslationTable{
    ["e_cards"] = "萌战卡牌包",
  }

fk.FrozenDamage = 9
Fk:addDamageNature(fk.FrozenDamage, "frozen_damage")

local slash = Fk:cloneCard("slash")
local SlashSkill = fk.CreateActiveSkill{
  name = "ev__slash_skill",
  prompt = "对对手造成1点伤害",
  max_phase_use_time = 1,
  target_num = 1,
  can_use = slash.skill.canUse,
  mod_target_filter = slash.skill.modTargetFilter,
  target_filter = slash.skill.targetFilter,
  on_effect = slash.skill.onEffect,
}

local Slash = fk.CreateBasicCard{
  name = "ev__slash",
  skill = SlashSkill,
  is_damage_card = true,
}

local FireSlashSkill = fk.CreateActiveSkill{
  name = "ev_fire__slash_skill",
  prompt = "对对手造成1点火焰伤害",
  max_phase_use_time = 1,
  target_num = 1,
  can_use = slash.skill.canUse,
  mod_target_filter = slash.skill.modTargetFilter,
  target_filter = slash.skill.targetFilter,
  on_effect = function(self, room, effect)
    local to = effect.to
    local from = effect.from
    room:damage({
      from = room:getPlayerById(from),
      to = room:getPlayerById(to),
      card = effect.card,
      damage = 1,
      damageType = fk.FireDamage,
      skillName = self.name
    })
  end
}

local FireSlash = fk.CreateBasicCard{
  name = "ev_fire__slash",
  skill = FireSlashSkill,
  is_damage_card = true,
}

local ThunderSlashSkill = fk.CreateActiveSkill{
  name = "ev_thunder__slash_skill",
  prompt = "对对手造成1点伤害",
  max_phase_use_time = 1,
  target_num = 1,
  can_use = slash.skill.canUse,
  mod_target_filter = slash.skill.modTargetFilter,
  target_filter = slash.skill.targetFilter,
  on_effect = function(self, room, effect)
    local to = effect.to
    local from = effect.from
    room:damage({
      from = room:getPlayerById(from),
      to = room:getPlayerById(to),
      card = effect.card,
      damage = 1,
      damageType = fk.ThunderDamage,
      skillName = self.name
    })
  end
}

local ThunderSlash = fk.CreateBasicCard{
  name = "ev_thunder__slash",
  skill = ThunderSlashSkill,
  is_damage_card = true,
}

local iceSlashSkill = fk.CreateActiveSkill{
  name = "ev_ice__slash_skill",
  prompt = "选择攻击范围内的一名角色，对其造成1点冰冻伤害",
  max_phase_use_time = 1,
  target_num = 1,
  can_use = slash.skill.canUse,
  mod_target_filter = slash.skill.modTargetFilter,
  target_filter = slash.skill.targetFilter,
  on_effect = function(self, room, effect)
    local to = effect.to
    local from = effect.from  
    room:damage({
      from = room:getPlayerById(from),
      to = room:getPlayerById(to),
      card = effect.card,
      damage = 1,
      damageType = fk.FrozenDamage,
      skillName = self.name
    })
  end
}

local IceSlash = fk.CreateBasicCard{
  name = "ev_ice__slash",
  skill = iceSlashSkill,
  is_damage_card = true,
}

extension:addCards{
  Slash:clone(Card.Spade, 3),
  Slash:clone(Card.Spade, 4),
  Slash:clone(Card.Spade, 6),
  Slash:clone(Card.Spade, 8),
  Slash:clone(Card.Spade, 10),
  Slash:clone(Card.Spade, 12),
  Slash:clone(Card.Spade, 13),
  Slash:clone(Card.Heart, 6),
  Slash:clone(Card.Heart, 9),
  Slash:clone(Card.Heart, 11),
  Slash:clone(Card.Club, 3),
  Slash:clone(Card.Club, 4),
  Slash:clone(Card.Club, 8),
  Slash:clone(Card.Club, 8),
  Slash:clone(Card.Club, 9),
  Slash:clone(Card.Club, 10),
  Slash:clone(Card.Club, 10),
  Slash:clone(Card.Club, 12),
  Slash:clone(Card.Club, 13),
  Slash:clone(Card.Diamond, 6),
  Slash:clone(Card.Diamond, 9),
  Slash:clone(Card.Diamond, 11),
  Slash:clone(Card.Diamond, 13),

  ThunderSlash:clone(Card.Spade, 2),
  ThunderSlash:clone(Card.Spade, 3),
  ThunderSlash:clone(Card.Spade, 5),
  ThunderSlash:clone(Card.Spade, 9),
  ThunderSlash:clone(Card.Club, 3),
  ThunderSlash:clone(Card.Club, 5),
  ThunderSlash:clone(Card.Club, 6),

  FireSlash:clone(Card.Heart, 6),
  FireSlash:clone(Card.Heart, 11),
  FireSlash:clone(Card.Diamond, 4),
  FireSlash:clone(Card.Diamond, 6),
  FireSlash:clone(Card.Diamond, 8),
  FireSlash:clone(Card.Diamond, 13),

  IceSlash:clone(Card.Spade, 3),
  IceSlash:clone(Card.Spade, 5),
  IceSlash:clone(Card.Spade, 8),
  IceSlash:clone(Card.Club, 3),
  IceSlash:clone(Card.Club, 7),
}

Fk:loadTranslationTable{
  ["ev__slash"] = "杀",
  [":ev__slash"] = "<b>基础牌</b></font><br/><b>时机</b>：出牌阶段<br/><b>目标</b>：一名攻击范围内的角色<br/><b>效果</b>：对目标角色造成1点伤害。",

  ["ev_fire__slash"] = "火杀",
  [":ev_fire__slash"] = "<b>基础牌</b></font><br/><b>时机</b>：出牌阶段<br/><b>目标</b>：一名攻击范围内的角色<br/><b>效果</b>：对目标角色造成1点火焰伤害。",

  ["ev_thunder__slash"] = "雷杀",
  [":ev_thunder__slash"] = "<b>基础牌</b></font><br/><b>时机</b>：出牌阶段<br/><b>目标</b>：一名攻击范围内的角色<br/><b>效果</b>：对目标角色造成1点雷电伤害。",

  ["ev_ice__slash"] = "冰杀",
  [":ev_ice__slash"] = "<b>基础牌</b></font><br/><b>时机</b>：出牌阶段<br/><b>目标</b>：一名攻击范围内的角色<br/><b>效果</b>：对目标角色造成1点霜冻伤害。", 
  ["frozen_damage"] = "霜冻",
}

local jinkSkill = fk.CreateActiveSkill{
  name = "ev__jink_skill",
  can_use = Util.FalseFunc,
  on_effect = function(self, room, effect)
    if effect.responseToEvent then
      effect.responseToEvent.isCancellOut = true
    end
  end
}

local jink = fk.CreateBasicCard{
  name = "ev__jink",
  skill = jinkSkill,
  is_passive = true,
}

  Fk:loadTranslationTable{
    ["ev__jink"] = "闪",
    [":ev__jink"] = "<b>基础牌</b></font><br/><b>时机</b>：【杀】对你生效前<br/><b>目标</b>：此【杀】<br/><b>效果</b>：抵消此【杀】。",
  }

  extension:addCards{
    jink:clone(Card.Heart, 2),
    jink:clone(Card.Heart, 2),
    jink:clone(Card.Heart, 4),
    jink:clone(Card.Heart, 5),
    jink:clone(Card.Heart, 5),
    jink:clone(Card.Heart, 6),
    jink:clone(Card.Heart, 8),
    jink:clone(Card.Heart, 9),
    jink:clone(Card.Heart, 12),
    jink:clone(Card.Heart, 13),
    jink:clone(Card.Diamond, 2),
    jink:clone(Card.Diamond, 2),
    jink:clone(Card.Diamond, 3),
    jink:clone(Card.Diamond, 4),
    jink:clone(Card.Diamond, 5),
    jink:clone(Card.Diamond, 5),
    jink:clone(Card.Diamond, 7),
    jink:clone(Card.Diamond, 8),
    jink:clone(Card.Diamond, 10),
    jink:clone(Card.Diamond, 11),
    jink:clone(Card.Diamond, 11),
    jink:clone(Card.Diamond, 12),
  }

local peach = Fk:cloneCard("peach")

local teaSkill = fk.CreateActiveSkill{
  name = "tea_skill",
  prompt = "#peach_skill",
  mod_target_filter = peach.skill.modTargetFilter,
  target_filter = peach.skill.targetFilter,
  can_use = peach.skill.canUse,
  on_use = peach.skill.onUse,
  on_effect = peach.skill.onEffect,
}

local tea = fk.CreateBasicCard{
  name = "ev__peach",
  skill = teaSkill,
}

extension:addCards{
  tea:clone(Card.Heart, 5),
  tea:clone(Card.Heart, 8),
  tea:clone(Card.Heart, 8),
  tea:clone(Card.Heart, 10),
  tea:clone(Card.Heart, 10),
  tea:clone(Card.Heart, 11),
  tea:clone(Card.Heart, 13),
  tea:clone(Card.Diamond, 3),
  tea:clone(Card.Diamond, 6),
  tea:clone(Card.Diamond, 7),
  tea:clone(Card.Diamond, 10),
  tea:clone(Card.Diamond, 10),
}  

  Fk:loadTranslationTable{
    ["ev__peach"] = "茶",
    [":ev__peach"] = "<b>基础牌</b></font><br/><b>时机：</b>出牌阶段。<br/>"..
    "<b>目标：</b>包括你在内的一名已受伤的角色（如无特殊说明只能对自己使用）。<br/><b>效果：</b>目标角色回复1点体力。<br/>"..
    "<b>使用方法②</b><br/><b>时机：</b>当一名角色处于濒死状态时。<br/><b>目标：</b>一名处于濒死状态的角色。<br/>"..
    "<b>效果：</b>目标角色回复1点体力。<br/>",
  }
  
  local poisonAction = fk.CreateTriggerSkill{
    name = "#ev__poison_action",
    global = true,
    --priority = 0.1,
    events = {fk.AfterCardsMove},
    anim_type = "negative",
    can_trigger = function(self, event, target, player, data)
      local poison_losehp = (data.extra_data or {}).ev_poison_losehp or {}
      return table.contains(poison_losehp, player.id) and table.every(player.room.alive_players, function(p) return not p.dying end)
    end,
    on_trigger = function(self, event, target, player, data)
      local poison_losehp = (data.extra_data or {}).ev_poison_losehp or {}
      player.room:notifySkillInvoked(player, self.name, "negative")
      player.room:loseHp(player, #table.filter(poison_losehp, function(pid) return pid == player.id end), "ev__poison")
    end,
    refresh_events = {fk.AfterCardsMove},
    can_refresh = function(self, event, target, player, data)
      for _, move in ipairs(data) do
        if move.toArea == Card.DiscardPile then
          --return player.phase ~= Player.NotActive
          return player.room.current and player.room.current == player
        end
      end
      return false
    end,
    on_refresh = function(self, event, target, player, data)
      for _, move in ipairs(data) do
        for _, info in ipairs(move.moveInfo) do
          if move.toArea == Card.DiscardPile then
            local id = info.cardId
            if Fk:getCardById(id).name == "ev__poison" then
              data.extra_data = data.extra_data or {}
              local poison_losehp = data.extra_data.ev_poison_losehp or {}
              table.insert(poison_losehp, player.id)
              data.extra_data.ev_poison_losehp = poison_losehp
            end
          end
        end
      end
    end,
  }
  
  Fk:addSkill(poisonAction)

  local poisonSkill = fk.CreateActiveSkill{
    name = "ev__poison_skill",
    prompt = "选择一名距离1的角色，其失去1点体力"..
    "<br /><font color=\"#F0E68C\"><b>此牌进入弃牌堆后当前回合角色失去1点体力！</b></font>",
    max_phase_use_time = 1,
    distance_limit = 1,
    target_num = 1,
    can_use = function(self, player, card)
      return self:withinTimesLimit(player, Player.HistoryPhase, card, "poison", player)
    end,
    mod_target_filter = function(self, to_select, selected, from, card, distance_limited)
      local player = Fk:currentRoom():getPlayerById(to_select)
      return from ~= player and not (distance_limited and not self:withinDistanceLimit(from, false, card, player))
    end,
    target_filter = Util.TargetFilter,
    on_effect = function(self, room, effect)
      local target = room:getPlayerById(effect.to)
      room:loseHp(target, 1, "ev__poison")
    end
  }
  
  local poison = fk.CreateBasicCard{
    name = "ev__poison",
    skill = poisonSkill,
  }

  extension:addCards{
    poison:clone(Card.Spade, 4),
    poison:clone(Card.Club, 4),
    poison:clone(Card.Club, 5),
  }  

  Fk:loadTranslationTable{
    ["ev__poison"] = "毒",
    [":ev__poison"] = "<b>基础牌</b><br /><b>时机</b>：出牌阶段限一次<br /><b>目标</b>：距离为1的一名其他角色<br /><b>效果</b>：目标角色失去1点体力。<br />锁定技，当此牌置入弃牌堆后，当前回合角色失去1点体力。",
    ["#ev__poison_action"] = "毒",
  }

local dismantlement = Fk:cloneCard("dismantlement")

local dismantlementSkill = fk.CreateActiveSkill{
  name = "ev__dismantlement_skill",
  prompt = "#dismantlement_skill",
  target_num = 1,
  mod_target_filter = dismantlement.skill.modTargetFilter,
  target_filter = dismantlement.skill.targetFilter,
  on_effect = function(self, room, effect)
    local from = room:getPlayerById(effect.from)
    local to = room:getPlayerById(effect.to)
    if from.dead or to.dead or to:isAllNude() then return end
    local cid = room:askForCardChosen(from, to, "hej", "ev__dismantlement")
    if cid then
      local reason = self.name
      if effect.card.skillName == "youlingxiji" then reason = "youlingxiji" end
      --room:throwCard({cid}, reason, to, from)
      room:moveCardTo(cid, Card.DiscardPile, nil, fk.ReasonDiscard, reason, "", true, effect.from)
    end
  end
}

local dismantlement = fk.CreateTrickCard{
  name = "ev__dismantlement",
  skill = dismantlementSkill,
}

extension:addCards({
  dismantlement:clone(Card.Spade, 4),
  dismantlement:clone(Card.Spade, 5),
  dismantlement:clone(Card.Spade, 8),
  dismantlement:clone(Card.Club, 2),
  dismantlement:clone(Card.Club, 6),
  dismantlement:clone(Card.Club, 7),
})

local snatch = Fk:cloneCard("snatch")

local snatchSkill = fk.CreateActiveSkill{
  name = "ev__snatch_skill",
  prompt = "#snatch_skill",
  distance_limit = 1,
  mod_target_filter = snatch.skill.modTargetFilter,
  target_filter = snatch.skill.targetFilter,
  target_num = 1,
  on_effect = function(self, room, effect)
    local from = room:getPlayerById(effect.from)
    local to = room:getPlayerById(effect.to)
    if from.dead or to.dead or to:isAllNude() then return end
    local cid = room:askForCardChosen(from, to, "hej", "ev__snatch")
    if cid then
      room:obtainCard(from, cid, false, fk.ReasonPrey)
    end
  end
}

local snatch = fk.CreateTrickCard{
  name = "ev__snatch",
  skill = snatchSkill,
}

extension:addCards({
  snatch:clone(Card.Spade, 2),
  snatch:clone(Card.Spade, 6),
  snatch:clone(Card.Spade, 7),
  snatch:clone(Card.Club, 10),
  snatch:clone(Card.Diamond, 5),
})

Fk:loadTranslationTable{
  ["ev__dismantlement"] = "破坏工作",
  [":ev__dismantlement"] = "<b>魔法牌</b><br /><b>时机</b>：出牌阶段<br /><b>目标</b>：一名区域里有牌的其他角色。<br /><b>效果</b>：你弃置目标角色区域里的一张牌。",
  ["ev__snatch"] = "掠夺行动",
  [":ev__snatch"] = "<b>魔法牌</b><br /><b>时机</b>：出牌阶段<br /><b>目标</b>：距离为1的一名区域里有牌的其他角色。<br /><b>效果</b>：你获得目标角色区域里的一张牌。",
}

  local duel = Fk:cloneCard("duel")

  local ev_duelSkill = fk.CreateActiveSkill{
    name = "ev__duel_skill",
    prompt = "#duel_skill",
    mod_target_filter = duel.skill.modTargetFilter,
    target_filter = duel.skill.targetFilter,
    target_num = 1,
    can_use = duel.skill.canUse,
    on_effect = duel.skill.onEffect,
  }
  
  local ev_duel = fk.CreateTrickCard{
    name = "ev__duel",
    skill = ev_duelSkill,
    is_damage_card = true,
  }
  
  extension:addCards{
    ev_duel:clone(Card.Spade, 1),
    ev_duel:clone(Card.Club, 2),
  }

  Fk:loadTranslationTable{
    ["ev__duel"] = "决斗",
    [":ev__duel"] = "<b>魔法牌</b><br /><b>时机</b>：出牌阶段<br /><b>目标</b>：一名其他角色<br /><b>效果</b>：由目标角色开始，其与你轮流打出【杀】，直到其中一名角色未打出【杀】。然后未打出【杀】的角色受到另一名角色对其造成的1点伤害。",
  }

  local collateral = Fk:cloneCard("collateral")

  local ev_collateralSkill = fk.CreateActiveSkill{
    name = "ev__collateral_skill",
    prompt = "#collateral_skill",
    mod_target_filter = collateral.skill.modTargetFilter,
    target_filter = collateral.skill.targetFilter,
    target_num = 2,
    on_use = collateral.skill.onUse,
    on_effect = collateral.skill.onEffect,
  }

  local ev_collateral = fk.CreateTrickCard{
    name = "ev__collateral",
    suit = Card.Spade,
    number = 11,
    skill = ev_collateralSkill,
  }
  
  extension:addCards({
    ev_collateral,
    ev_collateral:clone(Card.Club, 11),
  })

  Fk:loadTranslationTable{
    ["ev__collateral"] = "傀儡操纵",
    [":ev__collateral"] = "<b>魔法牌</b><br /><b>时机</b>：出牌阶段<br /><b>目标</b>：一名装备区里有武器牌且其攻击范围内有使用【杀】的目标的其他角色An<br /><b>子目标</b>：你在An成为目标的同时选择An攻击范围内的一个An使用【杀】的合法目标Bn；"..
    "<br /><b>效果</b>：目标角色An需对Bn使用【杀】，否则（将其装备区里的武器牌交给你）（n为目标角色的序号）。"..
    "<br /><font color=\"#708090\"><b>“借刀杀人换皮”",
  }

  local MidastouchSkill = fk.CreateActiveSkill{
    name = "midas_touch_skill",
    prompt = "弃置一张牌，摸三张牌",
    mod_target_filter = Util.TrueFunc,
    can_use = function(self, player, card)
      return not player:isProhibited(player, card)
    end,
    on_use = function(self, room, cardUseEvent)
      if not cardUseEvent.tos or #TargetGroup:getRealTargets(cardUseEvent.tos) == 0 then
        cardUseEvent.tos = { { cardUseEvent.from } }
      end
    end,
    on_effect = function(self, room, effect)
        local player = room:getPlayerById(effect.to)
        if not player:isNude() then
          local cards = room:askForDiscard(player, 1, 1, true, self.name, false)
          if #cards > 0 then
            player:drawCards(3, "midas_touch")
          end
        end
    end
}

local Midastouch = fk.CreateTrickCard{
  name = "midas_touch",
  skill = MidastouchSkill,
}

extension:addCards({
  Midastouch:clone(Card.Diamond, 1),
  Midastouch:clone(Card.Diamond, 9),
})

Fk:loadTranslationTable{
  ["midas_touch"] = "点石成金",
  [":midas_touch"] = "<b>魔法牌</b><br /><b>时机</b>：出牌阶段<br /><b>目标</b>：包括你在内的一名角色<br /><b>效果</b>：目标角色弃置一张牌，若如此做，其摸三张牌。",
}

local nullificationSkill = fk.CreateActiveSkill{
  name = "ev__nullification_skill",
  can_use = Util.FalseFunc,
  on_use = function(self, room, use)
    if use.responseToEvent.to then --开耦
      if use.card.skillName == "CDL" and use.card.number == use.toCard.number then
        local tos = room:askForChoosePlayers(room:getPlayerById(use.from), 
        table.map(room:getAlivePlayers(), Util.IdMapper), 1, 99, "#CDL-choose:::"..use.toCard:toLogString(), "CDL", true)
        if #tos > 0 then
          use.extra_data = use.extra_data or {}
          use.extra_data.null_targets = tos
        end
      else
        room:delay(1000)
      end
    else
      room:delay(1000)
    end
  end,
  on_effect = function(self, room, effect)
    if effect.responseToEvent then
      effect.responseToEvent.isCancellOut = true
      if (effect.extra_data or {}).null_targets and #(effect.extra_data or {}).null_targets > 0 then
        effect.responseToEvent.disresponsiveList = effect.responseToEvent.disresponsiveList or {}
        for _, p in ipairs(room.alive_players) do
          if table.contains((effect.extra_data or {}).null_targets, p.id) then
            table.insertIfNeed(effect.responseToEvent.nullifiedTargets, p.id)
            table.insertIfNeed(effect.responseToEvent.disresponsiveList, p.id)
          end
        end
      end
    end
  end
}
local nullification = fk.CreateTrickCard{
  name = "ev__nullification",
  skill = nullificationSkill,
  is_passive = true,
}

extension:addCards({
  nullification:clone(Card.Spade, 12),
  nullification:clone(Card.Heart, 12),
  nullification:clone(Card.Heart, 12),
  nullification:clone(Card.Club, 12),
  nullification:clone(Card.Diamond, 12),
  nullification:clone(Card.Diamond, 12),
})

Fk:loadTranslationTable{
  ["ev__nullification"] = "魔法禁令",
  [":ev__nullification"] = "<b>魔法牌</b><br /><b>时机</b>：一张魔法牌对一个目标生效前。<br /><b>目标</b>：一张对一个目标生效前的魔法牌。<br /><b>效果</b>：抵消此魔法牌。",
}

local savageAssaultSkill = fk.CreateActiveSkill{
  name = "ghost_assault_skill",
  prompt = "#savage_assault_skill",
  can_use = Util.AoeCanUse,
  on_use = Util.AoeOnUse,
  mod_target_filter = function(self, to_select, selected, player, card, distance_limited)
    return player.id ~= to_select
  end,
  on_effect = function(self, room, effect)
    local cardResponded = room:askForResponse(room:getPlayerById(effect.to), 'slash', nil, nil, true, nil, effect)
    if cardResponded then
      room:responseCard({
        from = effect.to,
        card = cardResponded,
        responseToEvent = effect,
      })
    else
      room:damage({
        from = nil,
        to = room:getPlayerById(effect.to),
        card = effect.card,
        damage = 1,
        damageType = fk.NormalDamage,
        skillName = self.name,
      })
    end
  end
}
local savageAssault = fk.CreateTrickCard{
  name = "ghost_assault",
  is_damage_card = true,
  multiple_targets = true,
  skill = savageAssaultSkill,
}

extension:addCards({
  savageAssault:clone(Card.Spade, 13),
  savageAssault:clone(Card.Club, 13),
})

local archeryAttackSkill = fk.CreateActiveSkill{
  name = "meteor_falling_skill",
  prompt = "#archery_attack_skill",
  can_use = Util.AoeCanUse,
  on_use = Util.AoeOnUse,
  mod_target_filter = function(self, to_select, selected, player, card, distance_limited)
    return player.id ~= to_select
  end,
  on_effect = function(self, room, effect)
    local cardResponded = room:askForResponse(room:getPlayerById(effect.to), 'jink', nil, nil, true, nil, effect)
    if cardResponded then
      room:responseCard({
        from = effect.to,
        card = cardResponded,
        responseToEvent = effect,
      })
    else
      room:damage({
        from = nil,
        to = room:getPlayerById(effect.to),
        card = effect.card,
        damage = 1,
        damageType = fk.NormalDamage,
        skillName = self.name,
      })
    end
  end
}
local archeryAttack = fk.CreateTrickCard{
  name = "meteor_falling",
  suit = Card.Spade,
  number = 1,
  is_damage_card = true,
  multiple_targets = true,
  skill = archeryAttackSkill,
}

extension:addCards({
  archeryAttack,
})

local godSalvationSkill = fk.CreateActiveSkill{
  name = "ev__god_salvation_skill",
  prompt = "#god_salvation_skill",
  can_use = Util.GlobalCanUse,
  on_use = Util.GlobalOnUse,
  mod_target_filter = Util.TrueFunc,
  about_to_effect = function(self, room, effect)
    if not room:getPlayerById(effect.to):isWounded() then
      return true
    end
  end,
  on_effect = function(self, room, effect)
    local player = room:getPlayerById(effect.from)
    local target = room:getPlayerById(effect.to)
    if target:isWounded() and not target.dead then
      room:recover({
        who = target,
        num = 1,
        recoverBy = player,
        card = effect.card,
        skillName = self.name,
      })
    end
  end
}

local godSalvation = fk.CreateTrickCard{
  name = "ev__god_salvation",
  suit = Card.Heart,
  number = 1,
  multiple_targets = true,
  skill = godSalvationSkill,
}

extension:addCards({
  godSalvation,
})

local BanquetSkill = fk.CreateActiveSkill{
  name = "banquet_skill",
  prompt = "#banquet_skill",
  can_use = Util.GlobalCanUse,
  on_use = Util.GlobalOnUse,
  mod_target_filter = Util.TrueFunc,
  on_effect = function(self, room, effect)
    local target = room:getPlayerById(effect.to)
    target:drawCards(1, self.name)
    if not target.dead and not target:isNude() then
      local targets = table.map(table.filter(room:getAlivePlayers(), function(p)
        return p:getNextAlive().id == target.id or p.id == target:getNextAlive().id end), Util.IdMapper)
        local tos, cards = U.askForChooseCardsAndPlayers(room, target, 1, 1, targets, 1, 1, ".", "#banquet-give", "banquet", false, false)
        if #cards == 0 then cards = {target:getCardIds("he")[1]} end
        room:moveCardTo(cards, Card.PlayerHand, room:getPlayerById(tos[1]), fk.ReasonGive, self.name, "", false, effect.to)
    end
  end
}

local Banquet = fk.CreateTrickCard{
  name = "banquet",
  suit = Card.Diamond,
  number = 7,
  multiple_targets = true,
  skill = BanquetSkill,
}

extension:addCards({
  Banquet,
})

Fk:loadTranslationTable{
  ["ghost_assault"] = "亡灵入侵",
  [":ghost_assault"] = "<b>魔法牌</b><br /><b>时机</b>：出牌阶段<br /><b>目标</b>：所有其他角色。<br /><b>效果</b>：目标角色需打出【杀】，否则受到1点无来源的伤害。",

  ["meteor_falling"] = "星辰陨落",
  [":meteor_falling"] = "<b>魔法牌</b><br /><b>时机</b>：出牌阶段<br /><b>目标</b>：所有其他角色。<br /><b>效果</b>：目标角色需打出【闪】，否则受到1点无来源的伤害。",

  ["ev__god_salvation"] = "治愈之泉",
  [":ev__god_salvation"] = "<b>魔法牌</b><br /><b>时机</b>：出牌阶段<br /><b>目标</b>：所有角色。<br /><b>效果</b>：目标角色回复1点体力。",

  ["banquet"] = "欢饮酒宴",
  [":banquet"] = "<b>魔法牌</b><br /><b>时机</b>：出牌阶段<br /><b>目标</b>：所有角色。<br /><b>效果</b>：目标角色摸一张牌，然后交给其上家或下家一张牌",
  ["#banquet_skill"] = "目标角色摸一张牌，然后交给其上家或下家一张牌",
  ["#banquet-give"] = "欢饮酒宴：请交给上家或下家一张牌",
}

local ironChainCardSkill = fk.CreateActiveSkill{
  name = "thorn_circle_skill",
  prompt = "#iron_chain_skill",
  min_target_num = 1,
  max_target_num = 2,
  mod_target_filter = Util.TrueFunc,
  target_filter = Util.TargetFilter,
  on_effect = function(_, room, cardEffectEvent)
    local to = room:getPlayerById(cardEffectEvent.to)
    to:setChainState(not to.chained)
  end,
}

local ironChain = fk.CreateTrickCard{
  name = "thorn_circle",
  skill = ironChainCardSkill,
  special_skills = { "recast" },
  multiple_targets = true,
}
extension:addCards{
  ironChain:clone(Card.Club, 1),
  ironChain:clone(Card.Club, 5),
  ironChain:clone(Card.Club, 6),
  ironChain:clone(Card.Club, 9),
  ironChain:clone(Card.Club, 11),
  ironChain:clone(Card.Club, 13),
}

Fk:loadTranslationTable{
  ["thorn_circle"] = "荆棘之环",
  [":thorn_circle"] = "<b>魔法牌</b><br /><b>时机</b>：出牌阶段<br /><b>目标</b>：一至两名角色。<br /><b>效果</b>：若目标角色横置，其重置，否则其横置。",
}

local HolyblessingSkill = fk.CreateActiveSkill{
  name = "holy_blessing_skill",
  prompt = "目标角色回复1点体力，然后若其未受伤，你弃置一张牌",
  target_num = 1,
  mod_target_filter = function(self, to_select, selected, player, card)
    local target = Fk:currentRoom():getPlayerById(to_select)
    return player.id ~= to_select and target:isWounded()
  end,
  target_filter = Util.TargetFilter,
  on_effect = function(self, room, effect)
    local player = room:getPlayerById(effect.from)
    local target = room:getPlayerById(effect.to)
    if target:isWounded() and not target.dead then
      room:recover({
        who = target,
        num = 1,
        recoverBy = player,
        card = effect.card,
        skillName = self.name,
      })
      if not target:isWounded() then
        room:askForDiscard(player, 1, 1, true, self.name, false)
      end
    end
  end
}

local Holyblessing = fk.CreateTrickCard{
  name = "holy_blessing",
  skill = HolyblessingSkill,
}

extension:addCards({
  Holyblessing:clone(Card.Heart, 1),
  Holyblessing:clone(Card.Heart, 3),
})

Fk:loadTranslationTable{
  ["holy_blessing"] = "神圣祝福",
  [":holy_blessing"] = "<b>魔法牌</b><br /><b>时机</b>：出牌阶段<br /><b>目标</b>：一名已受伤的其他角色。<br /><b>效果</b>：目标角色回复1点体力，然后若其未受伤，你弃置一张牌。",
}


local DoctrinalproclamaSkill = fk.CreateActiveSkill{
  name = "doctrinal_proclama_skill",
  prompt = "选择一至两名有手牌的角色，明置或暗置一张手牌",
  max_target_num = 2,
  min_target_num = 1,
  mod_target_filter = function(self, to_select, selected, user, card)
    return not Fk:currentRoom():getPlayerById(to_select):isKongcheng()
  end,
  target_filter = Util.TargetFilter,
  on_action = function(self, room, use, finished)
    if finished then
      local cards = {}
      for _, p in ipairs(room.alive_players) do
        table.insertTable(cards, p:getTableMark("@$shown"))
      end
      local player = room:getPlayerById(use.from)
      if #cards > 1 and table.every(cards, function(id) return Fk:getCardById(cards[1]).color == Fk:getCardById(id).color end) then
        local reason = "doctrinal_proclama"
        if use.card.skillName == "jiaotiaolichang" then reason = "jiaotiaolichang" end
        player:drawCards(2, reason)
      end
    end
  end,
  on_effect = function(self, room, effect)
    local from = room:getPlayerById(effect.from)
    local to = room:getPlayerById(effect.to)
    if from.dead or to.dead then return end
    local cid = room:askForCardChosen(from, to, "h", "doctrinal_proclama")
    if cid then
      if Fk:getCardById(cid):getMark("@@shown-inhand") == 0 then
        EV.OpenCards(room, to, cid, self.name, from)
      else
        EV.ConcealCards(room, to, cid, self.name, from)
      end
    end
  end,
}

local Doctrinalproclama = fk.CreateTrickCard{
  name = "doctrinal_proclama",
  skill = DoctrinalproclamaSkill,
}

extension:addCards({
  Doctrinalproclama:clone(Card.Heart, 3),
  Doctrinalproclama:clone(Card.Heart, 7),
})

Fk:loadTranslationTable{
  ["doctrinal_proclama"] = "教义宣示",
  [":doctrinal_proclama"] = "<b>魔法牌</b><br /><b>时机</b>：出牌阶段<br /><b>目标</b>：一至两名有手牌的角色。<br /><b>效果</b>：你明置或暗置目标角色的一张手牌，然后若所有角色的明置手牌颜色相同且总数不小于两张，你摸两张牌。",
}

local BlazingflameSkill = fk.CreateActiveSkill{
  name = "blazing_flame_skill",
  prompt = "目标角色展示所有手牌，你可弃置一张与其中一张牌花色相同的牌并对其造成1点火焰伤害",
  target_num = 1,
  mod_target_filter = function(self, to_select, selected, user, card, distance_limited)
    return not Fk:currentRoom():getPlayerById(to_select):isKongcheng()
  end,
  target_filter = Util.TargetFilter,
  on_effect = function(self, room, cardEffectEvent)
    local from = room:getPlayerById(cardEffectEvent.from)
    local to = room:getPlayerById(cardEffectEvent.to)
    if to:isKongcheng() then return end
    to:showCards(to:getCardIds(Player.Hand))
    local suits = {}
    for _, id in ipairs(to.player_cards[Player.Hand]) do
        local suit = Fk:getCardById(id):getSuitString()
        table.insertIfNeed(suits,suit)
    end
    local cards = room:askForDiscard(from, 1, 1, true, "blazing_flame", true,  ".|.|" .. table.concat(suits, ",") .. "|hand", "#blazing_flame-throw")
    if #cards > 0 then
      room:damage({
        from = from,
        to = to,
        card = cardEffectEvent.card,
        damage = 1,
        damageType = fk.FireDamage,
        skillName = "blazing_flame"
      })
    end
  end,
}

local Blazingflame = fk.CreateTrickCard{
  name = "blazing_flame",
  skill = BlazingflameSkill,
  is_damage_card = true,
}

extension:addCards({
  Blazingflame:clone(Card.Heart, 4),
  Blazingflame:clone(Card.Diamond, 1),
  Blazingflame:clone(Card.Diamond, 4),
})

Fk:loadTranslationTable{
  ["blazing_flame"] = "炽焰",
  [":blazing_flame"] = "<b>魔法牌</b><br /><b>时机</b>：出牌阶段<br /><b>目标</b>：一名有手牌的角色。<br /><b>效果</b>：目标角色展示所有手牌，然后你可弃置与其中的一张牌花色相同的手牌，若如此做，你对其造成1点火焰伤害。",
  ["#blazing_flame-throw"] = "炽焰：请选择弃置的牌",
}

local ThunderClapSkill = fk.CreateActiveSkill{
  name = "thunder_clap_skill",
  prompt = "目标角色展示牌堆顶的两张牌，若有梅花其此回合不能使用打出【闪】，若有黑桃你对其造成1点雷电伤害",
  target_num = 1,
  mod_target_filter = Util.TrueFunc,
  target_filter = Util.TargetFilter,
  on_effect = function(self, room, cardEffectEvent)
    local from = room:getPlayerById(cardEffectEvent.from)
    local to = room:getPlayerById(cardEffectEvent.to)
    local cards = room:getNCards(2)
    local clubs = table.filter(cards, function(id) return Fk:getCardById(id).suit == Card.Club end)
    local spades = table.filter(cards, function(id) return Fk:getCardById(id).suit == Card.Spade end)
    cards = table.reverse(cards)
    room:moveCardTo(cards, Card.Processing, nil, fk.ReasonJustMove, "thunder_clap", nil, true, cardEffectEvent.to)
    room:delay(1200)
    room:moveCardTo(table.reverse(cards), Card.DrawPile, nil, fk.ReasonPut, "thunder_clap", nil, true, cardEffectEvent.to)
    if #clubs > 0 then
      if not to:hasSkill("#thunder_clap_effect") then
        room:handleAddLoseSkills(to, "#thunder_clap_effect", nil, false, true)
      end
      room:setPlayerMark(to, "@@thunder_clap-turn", 1)
    end
    if #spades > 0 then
      room:damage({
        from = from,
        to = to,
        card = cardEffectEvent.card,
        damage = 1,
        damageType = fk.ThunderDamage,
        skillName = self.name
      })
    end
  end,
}

local ThunderClap = fk.CreateTrickCard{
  name = "thunder_clap",
  skill = ThunderClapSkill,
  is_damage_card = true,
}

local thunder_clap_effect = fk.CreateProhibitSkill{
  name = "#thunder_clap_effect",
  prohibit_use = function(self, player, card)
    return player:getMark("@@thunder_clap-turn") > 0 and card.trueName == "jink"
  end,
  prohibit_response = function(self, player, card)
    return player:getMark("@@thunder_clap-turn") > 0 and card.trueName == "jink"
  end,
}

Fk:addSkill(thunder_clap_effect)

extension:addCards({
  ThunderClap:clone(Card.Spade, 1),
  ThunderClap:clone(Card.Club, 1),
})

Fk:loadTranslationTable{
  ["thunder_clap"] = "惊雷",
  [":thunder_clap"] = "<b>魔法牌</b><br /><b>时机</b>：出牌阶段<br /><b>目标</b>：一名角色。<br /><b>效果</b>：目标角色展示牌堆顶的两张牌，若其中有梅花牌，其于当前回合内不能使用或打出【闪】；然后若其中有黑桃牌，你对其造成1点雷电伤害。",
  ["@@thunder_clap-turn"] = "<font color=\"#E4D00A\">惊雷</font>",
  ["#thunder_clap_effect"] = "惊雷",
}

local SnowstormSkill = fk.CreateActiveSkill{
  name = "snow_storm_skill",
  prompt = "目标角色需打出一张红色基础牌，否则受到1点霜冻伤害",
  can_use = Util.AoeCanUse,
  on_use = Util.AoeOnUse,
  mod_target_filter = function(self, to_select, selected, player, card, distance_limited)
    return player.id ~= to_select
  end,
  on_effect = function(self, room, effect)
    local cardResponded = room:askForResponse(room:getPlayerById(effect.to), ".|.|heart,diamond|.|.|basic", nil, "#snow_storm", true, nil, effect)
    if cardResponded then
      room:responseCard({
        from = effect.to,
        card = cardResponded,
        responseToEvent = effect,
      })
    else
      room:damage({
        from = nil,
        to = room:getPlayerById(effect.to),
        card = effect.card,
        damage = 1,
        damageType = fk.FrozenDamage,
        skillName = self.name,
      })
    end
  end
}
local Snowstorm = fk.CreateTrickCard{
  name = "snow_storm",
  suit = Card.Spade,
  number = 12,
  is_damage_card = true,
  multiple_targets = true,
  skill = SnowstormSkill,
}

extension:addCards({
  Snowstorm,
})

Fk:loadTranslationTable{
  ["snow_storm"] = "暴风雪",
  [":snow_storm"] = "<b>魔法牌</b><br /><b>时机</b>：出牌阶段<br /><b>目标</b>：所有其他角色。<br /><b>效果</b>：目标角色需打出一张红色基础牌，否则受到1点无来源的霜冻伤害。",
  ["#snow_storm"] = "请打出一张红色基础牌，否则受到1点无来源的霜冻伤害",
}

local ArmisticeSkill = fk.CreateActiveSkill{
  name = "armistices_skill",
  prompt = "目标角色可弃置任意张【杀】和武器牌，然后若没有这些牌则回复1点体力并摸一张牌",
  can_use = Util.GlobalCanUse,
  on_use = Util.GlobalOnUse,
  mod_target_filter = Util.TrueFunc,
  on_effect = function(self, room, effect)
    local target = room:getPlayerById(effect.to)
    local cards = room:askForDiscard(target, 1, 9999, true, "armistices", true, "slash;.|.|.|.|.|weapon", "#armistices-discard")
    if not table.find(target:getCardIds("he"), function(id) return Fk:getCardById(id).trueName == "slash"
      or Fk:getCardById(id).sub_type == Card.SubtypeWeapon end) then
        target:drawCards(1, "armistices")
        if target:isWounded() then
          room:recover({ who = target, num = 1, recoverBy = target, skillName = "armistices" })
        end
    end
  end
}

local Armistice = fk.CreateTrickCard{
  name = "armistices",
  suit = Card.Heart,
  number = 7,
  multiple_targets = true,
  skill = ArmisticeSkill,
}

extension:addCard(Armistice)

Fk:loadTranslationTable{
  ["armistices"] = "休战协定",
  [":armistices"] = "<b>魔法牌</b><br /><b>时机</b>：出牌阶段<br /><b>目标</b>：所有角色。<br /><b>效果</b>：目标角色可弃置任意张【杀】和武器牌，然后其展示所有手牌，若其没有【杀】和武器牌，其摸一张牌，回复1点体力。",
  ["#armistices-discard"] = "休战协定：你可以弃置任意张【杀】和武器牌",
}

local nightmare_effect = fk.CreateProhibitSkill{
  name = "#nightmare_effect",
  prohibit_use = function(self, player, card)
    return player:getMark("@@nightmare-turn") > 0 and card.color == Card.Black and Fk:currentRoom():getCardArea(card) == Player.Hand
  end,
}

Fk:addSkill(nightmare_effect)

local nightmareSkill = fk.CreateActiveSkill{
  name = "nightmare_skill",
  prompt = "#dark_nightmare_skill",
  mod_target_filter = function(self, to_select, selected, player, card, distance_limited)
    if card.skillName ~= "xudanyueluo" then
      return player.id ~= to_select
    else
      return player.id == to_select
    end
  end,
  target_filter = Util.TargetFilter,
  target_num = 1,
  on_effect = function(self, room, effect)
    local to = room:getPlayerById(effect.to)
    local judge = {
      who = to,
      reason = "dark_nightmare",
      pattern = ".|.|.|.|.|^trick",
    }
    room:judge(judge)
    local result = judge.card
    if result.type ~= Card.TypeTrick then
      room:addPlayerMark(to, "@@nightmare-turn", 1)
      room:addPlayerMark(to, "MinusMaxCards-turn", 1)
      room:handleAddLoseSkills(to, "#nightmare_effect", nil, false, true)
    end
    self:onNullified(room, effect)
  end,
  on_nullified = function(self, room, effect)
    room:moveCards{
      ids = room:getSubcardsByRule(effect.card, { Card.Processing }),
      toArea = Card.DiscardPile,
      moveReason = fk.ReasonUse
    }
  end,
}
local nightmare = fk.CreateDelayedTrickCard{
  name = "dark_nightmare",
  skill = nightmareSkill,
}

local jejunitasSkill = fk.CreateActiveSkill{
  name = "jejunitas_skill",
  prompt = "#jejunitas_skill",
  mod_target_filter = function(self, to_select, _, user, card, distance_limited)
    local player = Fk:currentRoom():getPlayerById(to_select)
    local from = Fk:currentRoom():getPlayerById(user)
    return from ~= player and player:getHandcardNum() >= player.hp
  end,
  target_filter = Util.TargetFilter,
  target_num = 1,
  on_effect = function(self, room, effect)
    local to = room:getPlayerById(effect.to)
    local judge = {
      who = to,
      reason = "jejunitas",
      pattern = ".|.|spade,club,diamond",
    }
    room:judge(judge)
    local result = judge.card
    if result.suit ~= Card.Heart then
      room:addPlayerMark(to, "AddMaxCards-turn", 1)
      to:skip(Player.Draw)
    end
    self:onNullified(room, effect)
  end,
  on_nullified = function(self, room, effect)
    room:moveCards{
      ids = room:getSubcardsByRule(effect.card, { Card.Processing }),
      toArea = Card.DiscardPile,
      moveReason = fk.ReasonUse
    }
  end,
}
local jejunitas = fk.CreateDelayedTrickCard{
  name = "jejunitas",
  skill = jejunitasSkill,
}

extension:addCards{
  jejunitas:clone(Card.Spade, 10),
  jejunitas:clone(Card.Club, 4),
  nightmare:clone(Card.Spade, 6),
  nightmare:clone(Card.Spade, 7),
}

local plaguesSkill = fk.CreateActiveSkill{
  name = "plagues_skill",
  prompt = "#plagues_skill",
  distance_limit = 1,
  mod_target_filter = function(self, to_select, _, from, card, distance_limited)
    local player = Fk:currentRoom():getPlayerById(to_select)
    return from == player or not (distance_limited and not self:withinDistanceLimit(from, false, card, player))
  end,
  target_filter = Util.TargetFilter,
  target_num = 1,
  on_effect = function(self, room, effect)
    local to = room:getPlayerById(effect.to)
    local judge = {
      who = to,
      reason = "plagues",
      pattern = ".|.|club",
    }
    room:judge(judge)
    local result = judge.card
    if result.suit == Card.Club then
      room:loseHp(to, 1, "plagues")
    end
    if result.suit == Card.Heart then
      room:moveCards{
        ids = Card:getIdList(effect.card),
        toArea = Card.DiscardPile,
        moveReason = fk.ReasonUse
      }
    else
      self:onNullified(room, effect)
    end
  end,
  on_nullified = function(self, room, effect)
    local to = room:getPlayerById(effect.to)
    local nextp = to
    repeat
      nextp = nextp:getNextAlive(true)
      if nextp == to then
        if nextp:isProhibited(nextp, effect.card) then
          room:moveCards{
            ids = room:getSubcardsByRule(effect.card, { Card.Processing }),
            toArea = Card.DiscardPile,
            moveReason = fk.ReasonPut
          }
          return
        end
        break
      end
    until not nextp:hasDelayedTrick("plagues") and not nextp:isProhibited(nextp, effect.card)
    if effect.card:isVirtual() then
      nextp:addVirtualEquip(effect.card)
    end
    room:moveCards{
      ids = room:getSubcardsByRule(effect.card, { Card.Processing }),
      to = nextp.id,
      toArea = Card.PlayerJudge,
      moveReason = fk.ReasonPut
    }
  end,
}

local plagues = fk.CreateDelayedTrickCard{
  name = "plagues",
  skill = plaguesSkill,
  suit = Card.Club,
  number = 13,
}

extension:addCards{
  plagues:clone(Card.Spade, 10),
  plagues,
}

Fk:loadTranslationTable{
  ["dark_nightmare"] = "漆黑梦魇",
  [":dark_nightmare"] = "<b>延时魔法牌</b><br /><b>时机</b>：出牌阶段<br /><b>目标</b>：一名其他角色。<br /><b>效果</b>：目标角色判定，若结果不为魔法牌，其于当前回合内手牌上限-1，且不能使用黑色手牌。",
  ["#dark_nightmare_skill"] = "目标角色判定，若结果不为魔法牌，其不能使用黑色牌且手牌上限-1",
  ["@@nightmare-turn"] = "<font color=\"#D8BFD8\">漆黑梦魇</font>",
  ["#nightmare_effect"] = "漆黑梦魇",

  ["jejunitas"] = "禁食之罚",
  [":jejunitas"] = "<b>延时魔法牌</b><br /><b>时机</b>：出牌阶段<br /><b>目标</b>：一名手牌数不小于其体力值的其他角色。<br /><b>效果</b>：目标角色判定，若结果不为红桃，其于当前回合内手牌上限+1，且跳过摸牌阶段。",
  ["#jejunitas_skill"] = "目标角色判定，若结果不为红桃，其跳过摸牌阶段且手牌上限+1",

  ["plagues"] = "瘟疫",
  [":plagues"] = "<b>延时魔法牌</b><br /><b>时机</b>：出牌阶段<br /><b>目标</b>：距离1以内的一名角色。<br /><b>效果</b>：目标角色判定，若结果为梅花，则其失去1点体力；若结果为红桃，则其将此牌置入弃牌堆。然后若结果不为红桃，则将此牌置入其下家的判定区（若其下家不为此牌的合法目标，则顺延至其下家的下家，以此类推；若所有角色都不是此【瘟疫】的合法目标，则将对应的实体牌置入其判定区）。",
  ["#plagues_skill"] = "目标角色判定，若结果为梅花，则其失去1点体力，不为红桃则移动至其下家",

}

local MystletainnSkill = fk.CreateTriggerSkill{
  name = "#mystletainn_skill",
  attached_equip = "mystletainn",
  priority = 0.1,
  events = {fk.EventPhaseEnd},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self.name) and player.phase == Player.Play
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local tos, id = room:askForChooseCardAndPlayers(player, table.map(player.room:getAlivePlayers(), function(p)
      return p.id end), 1, 1, "slash|.|.|.|.|.", "#mystletainn-choose", self.name, true)
    if #tos > 0 then
      self.cost_data = {tos[1], id}
      return true
    end 
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = room:getPlayerById(self.cost_data[1])
    --data.extra_data = data.extra_data or {}
    --data.extra_data.mystletainn = false
    room:setTag("mystletainn", "false")
    room:throwCard({self.cost_data[2]}, self.name, player, player)
    room:loseHp(to, 1, "mystletainn")
    if player.dead then return end
    if room:getTag("mystletainn") == "true" and not player:inMyAttackRange(to) then
      room:moveCardTo(player:getEquipment(Card.SubtypeWeapon), Card.DiscardPile, nil, fk.ReasonDiscard, self.name, true, player.id)
    end
  end,

  refresh_events = {fk.HpChanged},
  can_refresh = function(self, event, target, player, data)
    return player:hasSkill(self.name) and data.num < 0 and player.room:getTag("mystletainn") == "false" and data.skillName == "mystletainn"
  end,
  on_refresh = function(self, event, target, player, data)
    player.room:setTag("mystletainn", "true")
  end,
}

local Mystletainn = fk.CreateWeapon{
  name = "mystletainn",
  suit = Card.Club,
  number = 11,
  attack_range = 1,
  equip_skill = MystletainnSkill,
}

Fk:addSkill(MystletainnSkill)
extension:addCard(Mystletainn)

local ev__crossbowSkill = fk.CreateTargetModSkill{
  name = "#ev__crossbow_skill",
  attached_equip = "ev__crossbow",
  residue_func = function(self, player, skill, scope, card)
    if player:hasSkill(self.name) and skill.trueName == "slash_skill" and card.trueName == "slash"
      and scope == Player.HistoryPhase then
      return 2
    end
  end,
}

Fk:addSkill(ev__crossbowSkill)

local ev__crossbow = fk.CreateWeapon{
  name = "ev__crossbow",
  suit = Card.Club,
  number = 1,
  attack_range = 2,
  equip_skill = ev__crossbowSkill,
}

extension:addCard(ev__crossbow)

local ascalon_tar = fk.CreateTargetModSkill{
  name = "#ascalon_tar",
  bypass_distances = function(self, player, skill, card, to)
    return card and card.trueName == "slash" and player:hasSkill(self.name) and
    (to:getEquipment(Card.SubtypeOffensiveRide) ~= nil or to:getEquipment(Card.SubtypeDefensiveRide) ~= nil)
  end,
}

local AscalonSkill = fk.CreateTriggerSkill{
  name = "#ascalon_skill",
  attached_equip = "ascalon",
  priority = 0.1,
  events = {fk.DamageCaused},
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(self) and data.card and data.card.trueName == "slash" and (not data.chain) then
      local to = data.to
      return table.find(to:getCardIds(Player.Equip), function (id)
        local card = Fk:getCardById(id)
        return card.sub_type == Card.SubtypeDefensiveRide or card.sub_type == Card.SubtypeOffensiveRide
      end)
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = data.to
    local ride_tab = table.filter(to:getCardIds(Player.Equip), function (id)
      local card = Fk:getCardById(id)
      return card.sub_type == Card.SubtypeDefensiveRide or card.sub_type == Card.SubtypeOffensiveRide
    end)
    if #ride_tab == 0 then return end
    local id = room:askForCardChosen(player, to, {
      card_data = {
        { "servants_card", ride_tab }
      }
    }, self.name)
    room:throwCard({id}, self.name, to, player)
  end
}

AscalonSkill:addRelatedSkill(ascalon_tar)
Fk:addSkill(AscalonSkill)

local Ascalon = fk.CreateWeapon{
  name = "ascalon",
  suit = Card.Heart,
  number = 7,
  attack_range = 2,
  equip_skill = AscalonSkill,
}

extension:addCards({
  Ascalon,
})

local mjolnir_fix = fk.CreateTargetModSkill{
  name = "#mjolnir",
  bypass_distances = function(self, player, skill, card)
    return card and card.name == "ev_thunder__slash" and card.skillName == "mjolnir" and player:hasSkill(self.name)
  end,
}

local MjolnirSkill = fk.CreateViewAsSkill{
  name = "mjolnir_skill&",
  attached_equip = "mjolnir",
  pattern = "slash",
  card_filter = function(self, to_select, selected)
    if #selected ~= 0 then return false end
    return Fk:getCardById(to_select).name == "mjolnir"
  end,
  view_as = function(self, cards)
    if #cards ~= 1 then
      return nil
    end
    local c = Fk:cloneCard("ev_thunder__slash")
    c.skillName = "mjolnir"
    c:addSubcards(cards)
    return c
  end,
}

MjolnirSkill:addRelatedSkill(mjolnir_fix)
Fk:addSkill(MjolnirSkill)

local Mjolnir = fk.CreateWeapon{
  name = "mjolnir",
  suit = Card.Spade,
  number = 2,
  attack_range = 2,
  equip_skill = MjolnirSkill,
}

extension:addCard(Mjolnir)

local kerykeionSkill = fk.CreateTriggerSkill{
  name = "#kerykeion_skill",
  attached_equip = "kerykeion",
  events = { fk.TargetSpecified },
  priority = 0.1,
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self) and
      data.card and data.card.trueName == "slash" and not player.room:getPlayerById(data.to):isKongcheng()
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = room:getPlayerById(data.to)
    if not to:isKongcheng() then
      local id = room:askForCardChosen(player, to, {
        card_data = {
          {"$Hand", to:getCardIds(Player.Hand)},
        }
      }, self.name)
      if id ~= -1 then
        room:moveCardTo(id, Card.DiscardPile, nil, fk.ReasonDiscard, self.name, "", true, player.id)
        to:drawCards(1, "kerykeion")
      end
    end
  end,
}
Fk:addSkill(kerykeionSkill)

local kerykeion = fk.CreateWeapon{
  name = "kerykeion",
  suit = Card.Heart,
  number = 2,
  attack_range = 2,
  equip_skill = kerykeionSkill,
}

extension:addCards({
  kerykeion,
})

local TyrfingSkill = fk.CreateTriggerSkill{
  name = "#tyrfing_skill",
  attached_equip = "tyrfing",
  frequency = Skill.Compulsory,
  priority = 0.1,
  events = {fk.EventPhaseStart, fk.TargetSpecified},
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(self.name) then
      if event == fk.EventPhaseStart then
        return player.phase == Player.Finish and #player.room.logic:getEventsOfScope(GameEvent.ChangeHp, 1, function (e)
          local damage = e.data[5]
          if damage and target == damage.from and target ~= damage.to then
            return true
          end
        end, Player.HistoryTurn) == 0
      else
        return data.card and data.card.trueName == "slash" 
      end
    end
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if event == fk.EventPhaseStart then
      room:loseHp(player, 1, "tyrfing")
      if not player.dead then
        room:moveCardTo(player:getEquipment(Card.SubtypeWeapon), Card.DiscardPile, nil, fk.ReasonDiscard, self.name)
      end
    else
      --room:notifySkillInvoked(player, "tyrfing")
      data.disresponsive = true
    end
  end,
}

local Tyrfing = fk.CreateWeapon{
  name = "tyrfing",
  suit = Card.Spade,
  number = 11,
  attack_range = 2,
  equip_skill = TyrfingSkill,
}

Fk:addSkill(TyrfingSkill)
extension:addCard(Tyrfing)

local GungnirSkill = fk.CreateTriggerSkill{
  name = "#gungnir_skill",
  attached_equip = "gungnir",
  priority = 0.1,
  events = {fk.TargetSpecified},
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(self.name) then
      return data.card and data.card.trueName == "slash" 
    end
  end,
  on_cost = function(self, event, target, player, data)
    local pattern
    if player:getEquipment(Card.SubtypeWeapon) then
      pattern = ".|.|.|.|.|.|^"..tostring(player:getEquipment(Card.SubtypeWeapon))
    else
      pattern = "."
    end
    local discards = player.room:askForDiscard(player, 1, 1, true, self.name, true, pattern, "#gungnir-discard:::"..data.card:toLogString())
    return #discards > 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    data.disresponsive = true
  end,
}

local Gungnir = fk.CreateWeapon{
  name = "gungnir",
  suit = Card.Diamond,
  number = 13,
  attack_range = 3,
  equip_skill = GungnirSkill,
}

Fk:addSkill(GungnirSkill)
extension:addCard(Gungnir)

local SpiralSwordSkill = fk.CreateViewAsSkill{
  name = "spiral_sword_skill&",
  attached_equip = "spiral_sword",
  pattern = "slash",
  expand_pile = function()
    if Self:getMark("caikuang-turn") == 0 and #Self:getTableMark("ev__caikuang") ~= 0 then
      return Self:getTableMark("ev__caikuang")
    else
      return {}
    end
  end,
  card_filter = function(self, to_select, selected)
    if #selected == 2 then return false end
    return Fk:currentRoom():getCardArea(to_select) ~= Player.Equip
  end,
  view_as = function(self, cards)
    if #cards ~= 2 then
      return nil
    end
    local c = Fk:cloneCard("slash")
    c.skillName = "spiral_sword"
    c:addSubcards(cards)
    return c
  end,
}

Fk:addSkill(SpiralSwordSkill)

local SpiralSword = fk.CreateWeapon{
  name = "spiral_sword",
  suit = Card.Spade,
  number = 9,
  attack_range = 3,
  equip_skill = SpiralSwordSkill,
}

extension:addCard(SpiralSword)

local redroseSkill = fk.CreateTriggerSkill{
  name = "#redrose_sword_skill",
  attached_equip = "redrose_sword",
  frequency = Skill.Compulsory,
  priority = 0.1,
  events = { fk.TargetSpecified },
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self) and
      data.card and data.card.trueName == "slash"
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = room:getPlayerById(data.to)
    local use_event = room.logic:getCurrentEvent():findParent(GameEvent.UseCard, true)
    if use_event == nil then return end
    room:addPlayerMark(to, fk.MarkArmorNullified)
    use_event:addCleaner(function()
      room:removePlayerMark(to, fk.MarkArmorNullified)
    end)
  end,
}
Fk:addSkill(redroseSkill)

local redrose = fk.CreateWeapon{
  name = "redrose_sword",
  suit = Card.Diamond,
  number = 1,
  attack_range = 3,
  equip_skill = redroseSkill,
}

extension:addCards({
  redrose,
})

local leavatainSkill = fk.CreateTriggerSkill{
  name = "#leavatain_skill",
  attached_equip = "leavatain",
  priority = 0.1,
  events = {fk.Damage},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self) and data.card and data.card.trueName == "slash" and not data.to.dead and not data.chain and
      not player:isKongcheng() and table.find(player.room.alive_players, function(p) return data.to:distanceTo(p) == 1 and p ~= player end)
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local targets = table.map(table.filter(room.alive_players, function(p)
      return data.to:distanceTo(p) == 1 and p ~= player end), Util.IdMapper)
    if #targets == 0 then return false end
    local to, card = room:askForChooseCardAndPlayers(player, targets, 1, 1, ".|.|heart,diamond|hand", "#leavatain-invoke::"..data.to.id, self.name, true)
    if #to > 0 then
      self.cost_data = {to[1], card}
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = self.cost_data[1]
    room:notifySkillInvoked(player, "leavatain", "offensive")
    room:doIndicate(player.id, {to})
    room:throwCard(self.cost_data[2], "leavatain", player, player)
    room:damage{
      from = player,
      to = room:getPlayerById(to),
      damage = 1,
      skillName = "leavatain",
      damageType = fk.FireDamage,
    }
  end
}

Fk:addSkill(leavatainSkill)

local leavatain = fk.CreateWeapon{
  name = "leavatain",
  suit = Card.Spade,
  number = 10,
  attack_range = 4,
  equip_skill = leavatainSkill,
}
extension:addCard(leavatain)

local freeze_staffSkill = fk.CreateTriggerSkill{
  name = "#freeze_staff_skill",
  attached_equip = "freeze_staff",
  priority = 0.1,
  events = {fk.AfterCardUseDeclared, fk.DamageCaused},
  can_trigger = function(self, event, target, player, data)
    if event == fk.AfterCardUseDeclared then
        return target == player and player:hasSkill(self.name) and (data.card.name == "slash" or data.card.name == "ev__slash")
    else
        return target == player and player:hasSkill(self.name) and data.card and data.card.name == "ev_ice__slash" and player.phase ~= Player.NotActive
    end
  end,
  on_cost = function(self, event, target, player, data)
    if event == fk.AfterCardUseDeclared then
      return player.room:askForSkillInvoke(player, self.name, nil, "#freeze_staff-invoke")
    else
      local discards = player.room:askForDiscard(player, 1, 1, true, self.name, true, ".|.|.|.|.|trick", "#freeze_staff-discard::"..data.to.id)
      return #discards > 0
    end
  end,
  on_use = function(self, event, target, player, data)
    if event == fk.AfterCardUseDeclared then
      local iceSlash = Fk:cloneCard("ev_ice__slash")
      table.insertIfNeed(iceSlash.skillNames, "freeze_staff")
      iceSlash:addSubcard(data.card)
      player.room:sendLog{
        type = "#freeze_staff",
        from = player.id,
        arg = data.card:toLogString(),
        arg2 = iceSlash:toLogString(),
        toast = true,
      }
      data.card = iceSlash
    else
      local choices = {}
      for _, slot in ipairs(data.to:getAvailableEquipSlots()) do
        if slot == Player.OffensiveRideSlot or slot == Player.DefensiveRideSlot then
          table.insertIfNeed(choices, "RideSlot")
        else
          table.insert(choices, slot)
        end
      end
      if #choices == 0 then return end
      local choice = player.room:askForChoice(player, choices, "freeze_staff")
      if choice == "RideSlot" then
        choice = {Player.OffensiveRideSlot, Player.DefensiveRideSlot}
      end
      player.room:abortPlayerArea(data.to, choice)
    end
  end,
}

Fk:addSkill(freeze_staffSkill)

local freeze_staff = fk.CreateWeapon{
  name = "freeze_staff",
  suit = Card.Club,
  number = 4,
  attack_range = 4,
  equip_skill = freeze_staffSkill,
}

extension:addCard(freeze_staff)

local ApollobowSkill = fk.CreateTriggerSkill{
  name = "#apollo_bow_skill",
  attached_equip = "apollo_bow",
  priority = 0.1,
  events = { fk.TargetSpecified },
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(self) and data.card and data.card.trueName == "slash" then
      local to = player.room:getPlayerById(data.to)
      return #table.filter(to:getCardIds(Player.Hand), function(id) return Fk:getCardById(id):getMark("@@shown-inhand") == 0 end) > 0
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = room:getPlayerById(data.to)
    local id = room:askForCardChosen(player, to, "h", "apollo_bow", "#apollo_show")
    if id ~= -1 then
      EV.OpenCards(room, to, id, "apollo_bow", player)
      if Fk:getCardById(id).color == Card.Black and room:askForSkillInvoke(player, self.name, data, "#apollo-throw:::"..Fk:getCardById(id):toLogString()) then
        room:moveCardTo(id, Card.DiscardPile, nil, fk.ReasonDiscard, self.name, "", true, player.id)
      end
    end
  end,
}

Fk:addSkill(ApollobowSkill)

local Apollobow = fk.CreateWeapon{
  name = "apollo_bow",
  suit = Card.Heart,
  number = 9,
  attack_range = 5,
  equip_skill = ApollobowSkill,
}

extension:addCards({
  Apollobow,
})

Fk:loadTranslationTable{
  ["mystletainn"] = "米斯特汀",
  [":mystletainn"] = "装备牌·武器<br /><b>攻击范围</b>：1 <br/><b>武器技能</b>：出牌阶段结束时，你可弃置一张【杀】并选择一名角色，令其失去1点体力；当其以此法扣减体力后，若其不在你的攻击范围内，你弃置此牌。",
  ["#mystletainn_skill"] = "米斯特汀",
  ["#mystletainn-choose"] = "米斯特汀：你可弃置一张【杀】并令一名角色失去1点体力",

  ["ev__crossbow"] = "紫衫手弩",
  [":ev__crossbow"] = "装备牌·武器<br /><b>攻击范围</b>：2 <br/><b>武器技能</b>：锁定技，你使用【杀】的次数上限+2。",
  ["#ev__crossbow_skill"] = "紫衫手弩",

  ["ascalon"] = "阿斯卡隆",
  [":ascalon"] = "装备牌·武器<br /><b>攻击范围</b>：2 <br/><b>武器技能</b>：你对装备区里有随从牌的角色使用【杀】无距离限制。当你使用【杀】对目标角色造成伤害时，你可弃置其装备区里的随从牌。",
  ["#ascalon_tar"] = "阿斯卡隆",
  ["#ascalon_skill"] = "阿斯卡隆",
  ["servants_card"] = "随从牌",

  ["mjolnir"] = "妙尔尼尔",
  [":mjolnir"] = "装备牌·武器<br /><b>攻击范围</b>：2 <br/><b>武器技能</b>：你可将此牌当无距离限制的雷【杀】使用或打出。",
  ["mjolnir_skill&"] = "妙尔尼尔",
  [":mjolnir_skill&"] = "你可将此牌当无距离限制的雷【杀】使用或打出。",

  ["kerykeion"] = "双蛇杖",
  [":kerykeion"] = "装备牌·武器<br /><b>攻击范围</b>：2 <br/><b>武器技能</b>：当你使用【杀】指定一个目标后，你可观看其手牌并弃置其中的一张牌，然后其摸一张牌。",
  ["#kerykeion_skill"] = "双蛇杖",

  ["gungnir"] = "冈格尼尔",
  [":gungnir"] = "装备牌·武器<br /><b>攻击范围</b>：3 <br/><b>武器技能</b>：当你使用【杀】指定一个目标后，你可弃置一张牌，令此【杀】不是【闪】的合法目标。",
  ["#gungnir_skill"] = "冈格尼尔",
  ["#gungnir-discard"] = "你可以弃置一张牌，令 %arg 不可被响应",

  ["spiral_sword"] = "螺旋剑",
  [":spiral_sword"] = "装备牌·武器<br /><b>攻击范围</b>：3 <br/><b>武器技能</b>：你可将两张手牌当【杀】使用或打出。",
  ["spiral_sword_skill&"] = "螺旋剑",
  [":spiral_sword_skill&"] = "你可将两张手牌当【杀】使用或打出。",

  ["tyrfing"] = "提尔锋",
  [":tyrfing"] = "装备牌·武器<br /><b>攻击范围</b>：2 <br/><b>武器技能</b>：锁定技，你使用的【杀】不是【闪】的合法目标。结束阶段，若你于本回合内未造成过伤害，你失去1点体力，弃置此牌。",
  ["#tyrfing_skill"] = "提尔锋",

  ["redrose_sword"] = "破魔的红蔷薇",
  [":redrose_sword"] = "装备牌·武器<br /><b>攻击范围</b>：3 <br/><b>武器技能</b>：锁定技，当你使用【杀】指定一个目标后，你无视其防具。",
  ["#redrose_sword_skill"] = "破魔的红蔷薇",

  ["leavatain"] = "莱瓦汀",
  ["#leavatain_skill"] = "莱瓦汀",
  [":leavatain"] = "装备牌·武器<br/><b>攻击范围</b>：4 <br/><b>武器技能</b>：当你使用【杀】对目标角色造成伤害后，你可以弃置一张红色手牌，"..
  "对其距离1的一名其他角色造成1点伤害。",
  ["#leavatain-invoke"] = "莱瓦汀：你可以弃置一张红色手牌，对 %dest 距离1的一名其他角色造成1点伤害",

  ["freeze_staff"] = "冰封魔杖",
  ["#freeze_staff_skill"] = "冰封魔杖",
  [":freeze_staff"] = "装备牌·武器<br /><b>武器技能</b>：当你使用普【杀】时，可将之视为冰【杀】，当你于回合内使用冰【杀】对目标角色造成伤害时，你可弃置一张魔法牌，废除其一个装备栏。",
  ["#freeze_staff-invoke"] = "你可将此【杀】视为冰【杀】",
  ["#freeze_staff"] = "%from 将 %arg 视为%arg2",
  ["#freeze_staff-discard"] = "你可弃置一张魔法牌，废除%dest的一个装备栏",
  ["RideSlot"] = "随从栏",

  ["apollo_bow"] = "阿波罗之弓",
  [":apollo_bow"] = "装备牌·武器<br /><b>攻击范围</b>：5 <br/><b>武器技能</b>：当你使用【杀】指定一个目标后，你可明置其一张手牌；若此牌为黑色，你可弃置之。",
  ["#apollo_bow_skill"] = "阿波罗之弓",
  ["#apollo_show"] = "你可以明置目标角色的一张手牌",
  ["#apollo-throw"] = "你可以弃置 %arg",
}

local minosmazeSkill = fk.CreateTriggerSkill{
  name = "#minosmaze_skill",
  attached_equip = "minosmaze",
  priority = 0.1,
  events = {fk.AskForCardUse, fk.AskForCardResponse},
  can_trigger = function(self, event, target, player, data)
    if not (target == player and player:hasSkill(self) and
      (data.cardName == "ev__jink" or (data.pattern and Exppattern:Parse(data.pattern):matchExp("jink|0|nosuit|none")))) then return end
    if event == fk.AskForCardUse then
      return not player:prohibitUse(Fk:cloneCard("jink"))
    else
      return not player:prohibitResponse(Fk:cloneCard("jink"))
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local judgeData = {
      who = player,
      reason = "minosmaze",
      pattern = ".|.|heart,diamond",
    }
    room:judge(judgeData)
    if judgeData.card.color == Card.Red then
      if event == fk.AskForCardUse then
        data.result = {
          from = player.id,
          card = Fk:cloneCard('jink'),
        }
        data.result.card.skillName = "minosmaze"
        if data.eventData then
          data.result.toCard = data.eventData.toCard
          data.result.responseToEvent = data.eventData.responseToEvent
        end
      else
        data.result = Fk:cloneCard('jink')
        data.result.skillName = "minosmaze"
      end
      return true
    end
  end
}
Fk:addSkill(minosmazeSkill)

local MinosMaze = fk.CreateArmor{
  name = "minosmaze",
  equip_skill = minosmazeSkill,
}

extension:addCards({
  MinosMaze:clone(Card.Club, 8),
})

Fk:loadTranslationTable{
  ["minosmaze"] = "米诺斯迷宫",
  ["#minosmaze_skill"] = "米诺斯迷宫",
  [":minosmaze"] = "装备牌·防具<br /><b>防具技能</b>：当你需要使用或打出【闪】时，你可判定，若结果为红色，你视为使用或打出【闪】。",
}

local AchillesShieldSkill = fk.CreateTriggerSkill{
  name = "#achilles_shield_skill",
  attached_equip = "achilles_shield",
  priority = 0.1,
  frequency = Skill.Compulsory,
  events = {fk.PreCardEffect},
  can_trigger = function(self, event, target, player, data)
    return player.id == data.to and player:hasSkill(self) and
    data.card.trueName == "slash" and data.card.color == Card.Black
  end,
  on_use = Util.TrueFunc,
}

Fk:addSkill(AchillesShieldSkill)
local AchillesShield = fk.CreateArmor{
  name = "achilles_shield",
  suit = Card.Club,
  number = 2,
  equip_skill = AchillesShieldSkill,
}

extension:addCards({
  AchillesShield,
})

Fk:loadTranslationTable{
  ["achilles_shield"] = "阿喀琉斯之盾",
  ["#achilles_shield_skill"] = "阿喀琉斯之盾",
  [":achilles_shield"] = "装备牌·防具<br /><b>防具技能</b>：锁定技，黑色【杀】对你无效。",
}

local TenCommandmentsSkill = fk.CreateTriggerSkill{
  name = "#ten_commandments_skill",
  attached_equip = "ten_commandments",
  priority = 0.1,
  events = {fk.DamageInflicted},
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(self.name) then
      return data.card and data.card.trueName == "slash" and player:getHandcardNum() ~= 1
    end
  end,
  on_use = function(self, event, target, player, data)
    if player:getHandcardNum() < 1 then
      player:drawCards(1, "ten_commandments")
    else
      local n = player:getHandcardNum() - 1
      player.room:askForDiscard(player, n, n, false, "ten_commandments", false)
    end
    if not player.dead then
      player.room:sendLog{
        type = "#damage_prohibited",
        from = player.id,
        arg = "ten_commandments",
        arg2 = data.damage,
        toast = true,
      }
      return true
    end
  end,
}

Fk:addSkill(TenCommandmentsSkill)

local TenCommandments = fk.CreateArmor{
  name = "ten_commandments",
  suit = Card.Heart,
  number = 10,
  equip_skill = TenCommandmentsSkill,
}

extension:addCard(TenCommandments)

Fk:loadTranslationTable{
  ["ten_commandments"] = "十诫约柜",
  ["#ten_commandments_skill"] = "十诫约柜",
  [":ten_commandments"] = "装备牌·防具<br /><b>防具技能</b>：当你受到【杀】造成的伤害时，若你的手牌数不为1，你可将手牌摸至或弃置至一张，防止此伤害。",
  ["#damage_prohibited"] = "%from 的 %arg 防止了 %arg2 点伤害",
}

local CDL_choose = fk.CreateTriggerSkill{
  name = "#CDL_choose",
  refresh_events = {fk.PreCardEffect, fk.AfterCardUseDeclared},
  can_refresh = function(self, event, target, player, data)
    return player:hasSkill(self.name) and data.card.type == Card.TypeTrick
  end,
  on_refresh = function(self, event, target, player, data)
    local room = player.room
    if event == fk.PreCardEffect then
      room:setPlayerMark(player, "CDL_record", {data.card:getColorString()})
    elseif event == fk.AfterCardUseDeclared then--清理无效标记
      room:setPlayerMark(player, "CDL_record", 0)
    end
  end,
}

local CDLSkill = fk.CreateViewAsSkill{
  name = "CDL_skill&",
  attached_equip = "CDL",
  pattern = "nullification",
  prompt = "#CDL-use",
  card_filter = function(self, to_select, selected)
    local color = Self:getMark("CDL_record")
    if type(color) == "table" then
      color = color[1]
    else
      return false
    end
    return #selected == 0 and (Fk:getCardById(to_select):getColorString() ~= color or color == "nocolor")
    and Fk:currentRoom():getCardArea(to_select) == Card.PlayerHand
  end,
  view_as = function(self, cards)
    if #cards ~= 1 then
      return nil
    end
    local c = Fk:cloneCard("ev__nullification")
    c.skillName = "CDL"
    c:addSubcard(cards[1])
    return c
  end,
}

local CDL = fk.CreateArmor{
  name = "CDL",
  suit = Card.Club,
  number = 9,
  equip_skill = CDLSkill,
}

CDLSkill:addRelatedSkill(CDL_choose)
Fk:addSkill(CDLSkill)
extension:addCard(CDL)

Fk:loadTranslationTable{
  ["CDL"] = "破却宣言",
  ["CDL_skill&"] = "破却宣言",
  ["#CDL_choose"] = "破却宣言",
  [":CDL"] = "装备牌·防具<br /><b>防具技能</b>：你可将一张与目标魔法牌颜色不同的手牌当【魔法禁令】使用；且若目标魔法牌与之点数相同，此【魔法禁令】改为抵消目标魔法牌对任意名你选择的角色的效果。",
  [":CDL_skill&"] = "你可将一张与目标魔法牌颜色不同的手牌当【魔法禁令】使用。",
  ["#CDL-use"] = "破却宣言：你可以将一张与此牌颜色不同的手牌当【魔法禁令】使用",
  ["#CDL-choose"] = "请选择任意名角色，%arg 对这些角色无效",
}

local aigis_prohibit = fk.CreateProhibitSkill{
  name = "#aigis_prohibit",
  is_prohibited = function(self, from, to, card)
    return from:getMark("@@aigis-turn") > 0 and from ~= to
  end,
}

local AigisSkill = fk.CreateTriggerSkill{
  name = "#aigis_skill",
  attached_equip = "aigis",
  priority = 0.1,
  frequency = Skill.Compulsory,
  events = {fk.DamageInflicted, fk.TargetConfirmed},
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(self.name) then
      if event == fk.DamageInflicted then
        return data.card and data.card.type == Card.TypeTrick and player.gender == General.Male
      elseif event == fk.TargetConfirmed then
        return data.from ~= player.id and data.card.color == Card.Black and player.gender == General.Female
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    if event == fk.DamageInflicted then
      if not player.dead then
        player.room:sendLog{
          type = "#damage_prohibited",
          from = player.id,
          arg = "aigis",
          arg2 = data.damage,
          toast = true,
        }
        return true
      end
    else
      local room = player.room
      local from = room:getPlayerById(data.from)
      room:setPlayerMark(from, "@@aigis-turn", 1)
      local mark = player:getTableMark("aigis-turn")
      table.insertIfNeed(mark, data.from)
      room:setPlayerMark(player, "aigis-turn", mark)
    end
  end,
}

AigisSkill:addRelatedSkill(aigis_prohibit)
Fk:addSkill(AigisSkill)

local Aigis = fk.CreateArmor{
  name = "aigis",
  suit = Card.Spade,
  number = 13,
  equip_skill = AigisSkill,
  on_uninstall = function(self, room, player)
    if player:isAlive() and self.equip_skill:isEffectable(player) then
      room:handleAddLoseSkills(player, "-#aigis_skill")
      local mark = player:getTableMark("aigis-turn")
      if #mark > 0 then
        for _, id in ipairs(mark) do
          local to = room:getPlayerById(id)
          if not to.dead then
            room:setPlayerMark(to, "@@aigis-turn", 0)
          end
        end
      end
      room:setPlayerMark(player, "aigis-turn", 0)
    end
  end,
}

extension:addCards({
  Aigis,
  Aigis:clone(Card.Diamond, 3),
})

Fk:loadTranslationTable{
  ["aigis"] = "埃癸斯",
  ["#aigis_skill"] = "埃癸斯",
  ["@@aigis-turn"] = "埃癸斯",
  ["#aigis_prohibit"] = "埃癸斯",
  [":aigis"] = "装备牌·防具<br /><b>防具技能</b>：锁定技，若你为男性角色，则当你受到魔法牌造成的伤害时，防止之；"..
  "<br />若你为女性角色，则当你成为其他角色使用黑色牌的目标后，你令除其之外的角色不是其使用牌的合法目标，直至你失去装备区里的此牌或当前回合结束。",
}

local hippogriffSkill = fk.CreateDistanceSkill{
  name = "#hippogriffSkill",
  frequency = Skill.Compulsory,
  attached_equip = "hippogriff",
  correct_func = function(self, from, to)
    if from:hasSkill(self) and from.hp >= 2 then
      return -1
    elseif to:hasSkill(self) and to.hp <= 2 then
      return 1
    end
  end,
}

Fk:addSkill(hippogriffSkill)

local hippogriff = fk.CreateOffensiveRide{
  name = "hippogriff",
  suit = Card.Diamond,
  number = 2,
  equip_skill = hippogriffSkill,
  on_install = function(self, room, player)
    local cards = player:getEquipments(Card.SubtypeDefensiveRide)
    if #cards > 0 then room:moveCardTo(cards, Card.DiscardPile, nil, fk.ReasonPutIntoDiscardPile, self.name, nil, true, player.id) end
    OffensiveRide.onInstall(self, room, player)
  end,
  on_uninstall = function(self, room, player)
    OffensiveRide.onUninstall(self, room, player)
  end,
}

extension:addCards({
  hippogriff,
})

Fk:loadTranslationTable{
  ["hippogriff"] = "骏鹰",
  ["#hippogriff_skill"] = "骏鹰",
  [":hippogriff"] = "装备牌·随从<br /><b>随从技能</b>：锁定技，若你的体力值：不小于2，你与其他角色的距离-1；不大于2，其他角色与你的距离+1。",
}

local PegasusSkill = fk.CreateDistanceSkill{
  name = "#pegasusSkill",
  frequency = Skill.Compulsory,
  attached_equip = "pegasus",
  correct_func = function(self, from, to)
    if to:hasSkill(self) then
      if to.hp == 1 or #to:getCardIds(Player.Equip) == 1 then
        return 2
      else
        return 1
      end
    end
  end,
}

Fk:addSkill(PegasusSkill)

local Pegasus = fk.CreateDefensiveRide{
  name = "pegasus",
  suit = Card.Heart,
  number = 4,
  equip_skill = PegasusSkill,
  on_install = function(self, room, player)
    local cards = player:getEquipments(Card.SubtypeOffensiveRide)
    if #cards > 0 then room:moveCardTo(cards, Card.DiscardPile, nil, fk.ReasonPutIntoDiscardPile, self.name, nil, true, player.id) end
    DefensiveRide.onInstall(self, room, player)
  end,
  on_uninstall = function(self, room, player)
    DefensiveRide.onUninstall(self, room, player)
  end,
}

extension:addCards({
  Pegasus,
})

Fk:loadTranslationTable{
  ["pegasus"] = "珀伽索斯",
  ["#pegasus_skill"] = "珀伽索斯",
  [":pegasus"] = "装备牌·随从<br /><b>随从技能</b>：锁定技，其他角色与你的距离+1。"..
  "<br />若你的装备区里没有其它装备牌或你的体力值为1，则其他角色与你的距离+1。",
}

local phoenixSkill = fk.CreateTriggerSkill{
  name = "#phoenix_skill",
  attached_equip = "phoenix",
  priority = 0.1,
  events = {fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self.name) and player.phase == Player.Start
  end,
  on_cost = function(self, event, target, player, data)
    local discards = player.room:askForDiscard(player, 1, 1, true, self.name, true, ".|.|heart,diamond|hand", "#phoenix-discard")
    return #discards > 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:damage({
      from = player,
      to = player,
      damage = 1,
      damageType = fk.FireDamage,
      skillName = "phoenix"
    })
    if not player.dead then
      room:recover({
        who = player,
        num = 2,
        recoverBy = player,
        skillName = "phoenix"
      })
    end
  end,
}

local phoenix_distance = fk.CreateDistanceSkill{
  name = "#phoenix_distance",
  attached_equip = "phoenix",
  frequency = Skill.Compulsory,
  correct_func = function(self, from, to)
    if to:hasSkill(self) then
      return 1
    end
  end,
}
phoenixSkill:addRelatedSkill(phoenix_distance)
Fk:addSkill(phoenixSkill)

local phoenix = fk.CreateDefensiveRide{
  name = "phoenix",
  suit = Card.Diamond,
  number = 8,
  equip_skill = phoenixSkill,
  on_install = function(self, room, player)
    local cards = player:getEquipments(Card.SubtypeOffensiveRide)
    if #cards > 0 then room:moveCardTo(cards, Card.DiscardPile, nil, fk.ReasonPutIntoDiscardPile, self.name, nil, true, player.id) end
    DefensiveRide.onInstall(self, room, player)
  end,
  on_uninstall = function(self, room, player)
    DefensiveRide.onUninstall(self, room, player)
  end,
}

extension:addCards({
  phoenix,
})

Fk:loadTranslationTable{
  ["phoenix"] = "菲尼克斯",
  ["#phoenix_skill"] = "菲尼克斯",
  [":phoenix"] = "装备牌·随从<br /><b>随从技能</b>：锁定技，其他角色与你的距离+1。"..
  "<br />准备阶段，你可弃置一张红色手牌，对你造成1点火焰伤害，然后你回复2点体力。",
  ["#phoenix-discard"] = "你可弃置一张红色手牌，对你造成1点火焰伤害，然后你回复2点体力",
}

local hydra_distance = fk.CreateDistanceSkill{
  name = "#hydra_distance",
  attached_equip = "hydra",
  frequency = Skill.Compulsory,
  correct_func = function(self, from, to)
    if from:hasSkill(self) then
      return -1
    end
  end,
}

local Hydra_viewas = fk.CreateViewAsSkill{
  name = "hydra_viewas",
  pattern = "poison",
  card_filter = function(self, to_select, selected)
    if #selected > 0 then return false end
    return Fk:getCardById(to_select).suit == Card.Spade and Fk:currentRoom():getCardArea(to_select) == Card.PlayerHand
  end,
  view_as = function(self, cards)
    if #cards ~= 1 then return end
    local card = Fk:cloneCard("ev__poison")
    card.skillName = "hydra"
    card:addSubcard(cards[1])
    return card
  end,

  enabled_at_play = Util.FalseFunc,
  enabled_at_response = function(self, player, response)
    return not response
  end,
}

local HydraSkill = fk.CreateTriggerSkill{
  name = "#hydra_skill",
  attached_equip = "hydra",
  priority = 0.1,
  events = {fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self.name) and player.phase == Player.Finish
  end,
  on_cost = function(self, event, target, player, data)
    local success, dat = player.room:askForUseActiveSkill(player, "hydra_viewas", "#hydra-discard", true)
    if success then
      self.cost_data = dat
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local card = Fk.skills["hydra_viewas"]:viewAs(self.cost_data.cards)
    player.room:useCard{
      from = player.id,
      tos = table.map(self.cost_data.targets, function(id) return {id} end),
      card = card,
    }
  end,
}
Fk:addSkill(Hydra_viewas)
HydraSkill:addRelatedSkill(hydra_distance)
Fk:addSkill(HydraSkill)

local Hydra = fk.CreateOffensiveRide{
  name = "hydra",
  suit = Card.Spade,
  number = 9,
  equip_skill = HydraSkill,
  on_install = function(self, room, player)
    local cards = player:getEquipments(Card.SubtypeDefensiveRide)
    if #cards > 0 then room:moveCardTo(cards, Card.DiscardPile, nil, fk.ReasonPutIntoDiscardPile, self.name, nil, true, player.id) end
    OffensiveRide.onInstall(self, room, player)
  end,
  on_uninstall = function(self, room, player)
    OffensiveRide.onUninstall(self, room, player)
  end,
}

extension:addCards({
  Hydra,
})

Fk:loadTranslationTable{
  ["hydra"] = "海德拉",
  ["#hydra_skill"] = "海德拉",
  ["hydra_viewas"] = "海德拉",
  [":hydra"] = "装备牌·随从<br /><b>随从技能</b>：锁定技，你与其他角色的距离-1。"..
  "<br />结束阶段，你可将一张黑桃手牌当【毒】使用。",
  ["#hydra-discard"] = "你可将一张黑桃手牌当【毒】使用",
  ["#hydra-poison"] = "请选择【毒】的目标角色",
}

local FenrirSkill = fk.CreateTriggerSkill{
  name = "#fenrir_skill",
  attached_equip = "fenrir",
  priority = 0.1,
  frequency = Skill.Compulsory,
  events = {fk.DamageCaused},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self.name) and data.from ~= data.to and
    table.every(player.room:getOtherPlayers(data.to), function (p) return p.hp < data.to.hp end)
  end,
  on_use = function(self, event, target, player, data)
    data.damage = data.damage + 1
  end,
}

local fenrir_distance = fk.CreateDistanceSkill{
  name = "#fenrir_distance",
  attached_equip = "fenrir",
  frequency = Skill.Compulsory,
  correct_func = function(self, from, to)
    if from:hasSkill(self) then
      return -1
    end
  end,
}

FenrirSkill:addRelatedSkill(fenrir_distance)
Fk:addSkill(FenrirSkill)

local Fenrir = fk.CreateOffensiveRide{
  name = "fenrir",
  suit = Card.Spade,
  number = 11,
  equip_skill = FenrirSkill,
  on_install = function(self, room, player)
    local cards = player:getEquipments(Card.SubtypeDefensiveRide)
    if #cards > 0 then room:moveCardTo(cards, Card.DiscardPile, nil, fk.ReasonPutIntoDiscardPile, self.name, nil, true, player.id) end
    OffensiveRide.onInstall(self, room, player)
  end,
  on_uninstall = function(self, room, player)
    OffensiveRide.onUninstall(self, room, player)
  end,
}

extension:addCards({
  Fenrir,
})

Fk:loadTranslationTable{
  ["fenrir"] = "芬里厄",
  ["#fenrir_skill"] = "芬里厄",
  [":fenrir"] = "装备牌·随从<br /><b>随从技能</b>：锁定技，你与其他角色的距离-1。"..
  "<br />当你对其他角色造成伤害时，若其为体力值唯一最大的角色，则你令伤害值+1。",
}

local UnicornSkill = fk.CreateTriggerSkill{
  name = "#unicorn_skill",
  priority = 0.1,
  events = {fk.PreHpLost},
  frequency = Skill.Compulsory,
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self.name) and (target == player or EV.inFormationRelation(player, target))
    and data.skillName == "ev__poison"
  end,
  on_cost = Util.TrueFunc,
  on_use = Util.TrueFunc,
}

local unicorn_distance = fk.CreateDistanceSkill{
  name = "#unicorn_distance",
  attached_equip = "unicorn",
  frequency = Skill.Compulsory,
  correct_func = function(self, from, to)
    if to:hasSkill(self) then
      return 1
    end
  end,
}

UnicornSkill:addRelatedSkill(unicorn_distance)
Fk:addSkill(UnicornSkill)

local Unicorn = fk.CreateDefensiveRide{
  name = "unicorn",
  suit = Card.Heart,
  number = 1,
  equip_skill = UnicornSkill,
  on_install = function(self, room, player)
    local cards = player:getEquipments(Card.SubtypeOffensiveRide)
    if #cards > 0 then room:moveCardTo(cards, Card.DiscardPile, nil, fk.ReasonPutIntoDiscardPile, self.name, nil, true, player.id) end
    DefensiveRide.onInstall(self, room, player)
  end,
  on_uninstall = function(self, room, player)
    DefensiveRide.onUninstall(self, room, player)
  end,
}

extension:addCards({
  Unicorn,
})

Fk:loadTranslationTable{
  ["unicorn"] = "独角兽",
  ["#unicorn_skill"] = "独角兽",
  [":unicorn"] = "装备牌·随从<br /><b>随从技能</b>：锁定技，其他角色与你的距离+1。"..
  "<br />当你及与你处于同一队列的其他角色因【毒】的效果而失去体力时，防止之。",
}

Fk:addPoxiMethod{
  name = "holy_grail",
  card_filter = function(to_select, selected, data)
    return Fk:getCardById(to_select).color == Card.Red
  end,
  feasible = function(selected, data)
    local room = Fk:currentRoom()
    local cards1 = table.filter(selected, function(id) return room:getCardArea(id) == Card.PlayerHand end)
    local cards2 = table.filter(selected, function(id) return room:getCardArea(id) ~= Card.PlayerHand end)
    return #selected > 0 and #cards1 == #cards2
  end,
  prompt = "圣杯：请选择任意张红色手牌和等量亮出的红色牌"
}

local holygrailSkill = fk.CreateTriggerSkill{
  name = "#holy_grail_skill",
  --anim_type = "offensive",
  events = {fk.EventPhaseStart},
  priority = 0.1,
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self.name) and player.phase == Player.Finish
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:loseHp(player, 1, self.name)
    local cards = room:getNCards(5)
    room:moveCardTo(cards, Card.Processing, nil, fk.ReasonJustMove, self.name)
    --local friends = U.GetFriends(room, player)
    local players = room:getAlivePlayers(true)
    local friends = table.filter(players, function (p) return p == player or EV.isFriend(player, p) end)
    for _, p in ipairs(friends) do
      if #table.filter(cards, function(id) return Fk:getCardById(id).color == Card.Red end) == 0 then break end
      local handcards = table.filter(p:getCardIds(Player.Hand), function(id) return Fk:getCardById(id):getMark("@@shown-inhand") == 0 end)
      if #handcards > 0 then
        local chosen = room:askForPoxi(p, "holy_grail", {
          { "holy_grail", cards },
          { "$Hand", handcards },
        })
        if #chosen > 0 then
          local cards1 = table.filter(chosen, function(id) return table.contains(p:getCardIds(Player.Hand), id) end)
          local cards2 = table.filter(chosen, function(id) return table.contains(cards, id) end)
          EV.OpenCards(room, p, cards1, "holy_grail")
          room:moveCardTo(cards2, Card.PlayerHand, p, fk.ReasonJustMove, "holy_grail")
          table.forEach(cards2, function(id) table.removeOne(cards, id) end)
        end
      end
    end
    room:moveCardTo(cards, Card.DiscardPile, nil, fk.ReasonPutIntoDiscardPile, self.name)
  end,
}

local holy_grail = fk.CreateTreasure{
  name = "holy_grail",
  suit = Card.Heart,
  number = 13,
  equip_skill = holygrailSkill,
}

Fk:addSkill(holygrailSkill)
extension:addCard(holy_grail)

local goldenappleSkill = fk.CreateTriggerSkill{
  name = "#goldenapple_skill",
  priority = 0.1,
  events = {fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self.name) and player.phase == Player.Finish and #player.room.alive_players > 2
  end,
  on_cost = function(self, event, target, player, data)
    local targets = {}
    for _, p in ipairs(player.room:getOtherPlayers(player)) do
        if not p:isKongcheng() and (p:getNextAlive().id == player.id or p.id == player:getNextAlive().id) then
          table.insert(targets, p.id)
        end
    end
    if #targets == 2 then
      self.cost_data = targets
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local first = room:getPlayerById(self.cost_data[1])
    local last = room:getPlayerById(self.cost_data[2])
    local pindian = first:pindian({last}, self.name)
    local result = pindian.results[last.id]--FIXME：此时拼点牌在弃牌堆，待优化
    if result.winner then
      local card = pindian.fromCard
      if result.winner == last then card = result.toCard end
      if card then
        room:obtainCard(player, card, true, fk.ReasonJustMove)
        room:obtainCard(result.winner, player:getEquipment(Card.SubtypeTreasure), true, fk.ReasonJustMove)
      end
    end
  end,
}

local goldenapple = fk.CreateTreasure{
  name = "goldenapple",
  suit = Card.Heart,
  number = 3,
  equip_skill = goldenappleSkill,
}

Fk:addSkill(goldenappleSkill)
extension:addCard(goldenapple)

local gold_lotr_viewas = fk.CreateViewAsSkill{
  name = "gold_lotr_viewas",
  pattern = "midas_touch",
  card_filter = function(self, to_select, selected)
    if #selected > 0 then return false end
    return Fk:currentRoom():getCardArea(to_select) == Card.PlayerHand
  end,
  view_as = function(self, cards)
    if #cards ~= 1 then return end
    local card = Fk:cloneCard("midas_touch")
    card.skillName = "gold_lotr"
    card:addSubcard(cards[1])
    return card
  end,

  enabled_at_play = Util.FalseFunc,
  enabled_at_response = function(self, player, response)
    return not response
  end,
}

local gold_lotrSkill = fk.CreateTriggerSkill{
  name = "#gold_lotr_skill",
  frequency = Skill.Compulsory,
  priority = 0.1,
  mute = true,
  events = {fk.EventPhaseEnd},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self) and player.phase == Player.Draw and not player:isKongcheng()
  end,
  on_cost = function(self, event, target, player, data)
    local success, dat = player.room:askForUseActiveSkill(player, "gold_lotr_viewas", "#gold_lotr_ask", false)
    if success then
      self.cost_data = dat
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    player.room:notifySkillInvoked(player, self.name, "drawcard")
    local card = Fk.skills["gold_lotr_viewas"]:viewAs(self.cost_data.cards)
    player.room:useCard{
      from = player.id,
      tos = table.map(self.cost_data.targets, function(id) return {id} end),
      card = card,
    }
  end,
}

local gold_lotr_maxcards = fk.CreateMaxCardsSkill{
  name = "#gold_lotr_maxcards",
  correct_func = function(self, player)
    if player:hasSkill(self) then
      return -1
    end
  end,
}

local gold_lotr = fk.CreateTreasure{
  name = "gold_lotr",
  suit = Card.Diamond,
  number = 9,
  equip_skill = gold_lotrSkill,
}

gold_lotrSkill:addRelatedSkill(gold_lotr_maxcards)
Fk:addSkill(gold_lotrSkill)
Fk:addSkill(gold_lotr_viewas)
extension:addCard(gold_lotr)

Fk:loadTranslationTable{
  ["holy_grail"] = "圣杯",
  ["#holy_grail_skill"] = "圣杯",
  [":holy_grail"] = "装备牌·宝物<br /><b>宝物技能</b>：结束阶段，你可失去1点体力，亮出牌堆顶的五张牌；你或己方角色各可明置至少一张红色手牌，获得其中的等量张红色牌。",

  ["goldenapple"] = "金苹果",
  ["#goldenapple_skill"] = "金苹果",
  [":goldenapple"] = "装备牌·宝物<br /><b>宝物技能</b>：锁定技，结束阶段，你的上家与你的下家拼点，然后你将此牌交给拼点赢的角色，获得其拼点的牌。",
  [":#goldenapple_skill"] = "锁定技，结束阶段，你的上家与你的下家拼点，然后你将此牌交给拼点赢的角色，获得其拼点的牌。",

  ["gold_lotr"] = "黄金魔戒",
  ["#gold_lotr_skill"] = "黄金魔戒",
  ["gold_lotr_viewas"] = "黄金魔戒",
  [":gold_lotr"] = "装备牌·宝物<br /><b>宝物技能</b>：锁定技，摸牌阶段结束时，你将一张手牌当【点石成金】使用。你的手牌上限-1。",
  ["#gold_lotr_ask"] = "黄金魔戒：请选择一张手牌当【点石成金】使用",
}

return extension